package com.example.itshome.activity;

import android.view.View;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.itshome.R;
import com.example.itshome.adapter.SignInActivityRecycleViewAdapter;
import com.example.itshome.adapter.SignUpActivityRecycleViewAdapter;
import com.example.itshome.entity.ActivityEntity;
import com.example.itshome.impl.ItemDecorationImpl;
import com.example.itshome.network.AbstractRecycleVIewGetRequest;
import com.example.itshome.network.GetSignedInActivityRequest;

import java.util.ArrayList;
import java.util.List;

public class SignedInActivityPageActivity extends AppCompatActivity {

    private ImageView backImageView;
    private RecyclerView mRecycleView;
    private List<ActivityEntity> mRecycleViewData;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signed_in_activity_page);
        initFind();
        initButton();
        initRecycleView();
    }

    void initFind(){
        backImageView=findViewById(R.id.imv_signed_in_page_back);
        mRecycleView=findViewById(R.id.rcv_signed_in_activity_page);
    }


    private void initButton(){
        backImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    void initRecycleView(){
        mRecycleViewData=new ArrayList<>();
        mRecycleView.setLayoutManager(new LinearLayoutManager(this));
        mRecycleView.setAdapter(new SignInActivityRecycleViewAdapter(this,mRecycleViewData));
        mRecycleView.addItemDecoration(new ItemDecorationImpl(this,10,0));
        AbstractRecycleVIewGetRequest<ActivityEntity> request=new GetSignedInActivityRequest(this)
                .setAdapter(mRecycleView.getAdapter())
                .setCurrentData(mRecycleViewData);
        request.start();
    }
}